1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module shumate.Compass; 26 27 private import glib.ConstructionException; 28 private import gobject.ObjectG; 29 private import gtk.AccessibleIF; 30 private import gtk.AccessibleT; 31 private import gtk.BuildableIF; 32 private import gtk.BuildableT; 33 private import gtk.ConstraintTargetIF; 34 private import gtk.ConstraintTargetT; 35 private import gtk.Widget; 36 private import shumate.Viewport; 37 private import shumate.c.functions; 38 public import shumate.c.types; 39 40 41 /** 42 * A widget displaying a compass. 43 * 44 * # CSS nodes 45 * 46 * ``` 47 * map-compass 48 * ├── revealer 49 * ├──── image 50 * ``` 51 * 52 * `ShumateCompass` uses a single CSS node with name map-compass. It also uses an 53 * image named "map-compass". 54 */ 55 public class Compass : Widget 56 { 57 /** the main Gtk struct */ 58 protected ShumateCompass* shumateCompass; 59 60 /** Get the main Gtk struct */ 61 public ShumateCompass* getCompassStruct(bool transferOwnership = false) 62 { 63 if (transferOwnership) 64 ownedRef = false; 65 return shumateCompass; 66 } 67 68 /** the main Gtk struct as a void* */ 69 protected override void* getStruct() 70 { 71 return cast(void*)shumateCompass; 72 } 73 74 /** 75 * Sets our main struct and passes it to the parent class. 76 */ 77 public this (ShumateCompass* shumateCompass, bool ownedRef = false) 78 { 79 this.shumateCompass = shumateCompass; 80 super(cast(GtkWidget*)shumateCompass, ownedRef); 81 } 82 83 84 /** */ 85 public static GType getType() 86 { 87 return shumate_compass_get_type(); 88 } 89 90 /** 91 * Creates an instance of #ShumateCompass. 92 * 93 * Params: 94 * viewport = a #ShumateViewport 95 * 96 * Returns: a new #ShumateCompass. 97 * 98 * Throws: ConstructionException GTK+ fails to create the object. 99 */ 100 public this(Viewport viewport) 101 { 102 auto __p = shumate_compass_new((viewport is null) ? null : viewport.getViewportStruct()); 103 104 if(__p is null) 105 { 106 throw new ConstructionException("null returned by new"); 107 } 108 109 this(cast(ShumateCompass*) __p); 110 } 111 112 /** 113 * Gets the viewport used by the compass. 114 * 115 * Returns: The #ShumateViewport used by the compass 116 */ 117 public Viewport getViewport() 118 { 119 auto __p = shumate_compass_get_viewport(shumateCompass); 120 121 if(__p is null) 122 { 123 return null; 124 } 125 126 return ObjectG.getDObject!(Viewport)(cast(ShumateViewport*) __p); 127 } 128 129 /** 130 * Sets the compass viewport. 131 * 132 * Params: 133 * viewport = a [class@Viewport] 134 */ 135 public void setViewport(Viewport viewport) 136 { 137 shumate_compass_set_viewport(shumateCompass, (viewport is null) ? null : viewport.getViewportStruct()); 138 } 139 }